
angular.module('myorder-pay.controller', ['myorder-pay.service'])
    .controller("myorder-payCtrl", function ($scope,$http,$rootScope,$location) {

        var CCSessionId =localStorage.getItem("CCSessionId"),
            port=$rootScope.myglobal.serverurl;

        //根据传过来的数据判断是由哪个（所在任务/消费类品）点击
        var urlchoose=null
        //!$location.$$url.split('?')[1]

        if($location.$$url.indexOf('?')<0){
            urlchoose=3
        }else {
            console.log('123');
            urlchoose=$location.$$url.split('?')[1].split('choos=')[1]
        }


        //显示页面应该显示什么数据
        var json1=null,param=null,json2=null;
        if(urlchoose==3){
            json1='/authority/base-dictionary.json?'
            param='&categoryCode=PAYTYPE&subCategoryCode=TYPECODE'
        }else if(urlchoose==2){
            json1='/gwb/offical/1.json?'
            //根据选择的账户获得accountId,,,$rootScope.payerno是被选择的账户信息
            if($rootScope.payerno){
                param='&flag=2&accountId='+$rootScope.payerno
            }else{
                param='&flag=2&accountId=752'
            }

        }else if(urlchoose==1){
            json1='/account/account/1.json?'
            param='&innerVal=1&acctType=2&nominal=1'
        }

        var url0= port+json1+'CCSessionId='+CCSessionId


//获取消费品类时所获取数据
        $http.get(url0+param)
            .success(function(data){
                console.log(data);
                $scope.objlist=data;
                //jiang

                console.log($scope.obj);
            })
        //保存所选择的数据以便myorder-gwb页面的渲染
        $scope.gei=function(a){
            if(urlchoose==3){
                $rootScope.chooseclass=a
            }else if(urlchoose==2){
                $rootScope.task= a
            }else if(urlchoose==1){
                $rootScope.payerno= a
            }

        }

    })




